package smb.interceptor;

import java.util.Arrays;

import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;

public class TimeInterceptor {
	private static final Logger Log = Logger.getLogger(TimeInterceptor.class);

	public Object round(ProceedingJoinPoint pjp) {
		Long startTime = System.nanoTime();
		Log.info("开始调用" + pjp.getTarget() + "的方法，方法名为" + pjp.getSignature().getName() + "参数是"
				+ Arrays.toString(pjp.getArgs()));
		Object result = null;
		try {
			result = pjp.proceed();
			Long endTime = System.nanoTime();
			Log.info("方法的执行时间是>>>>>>>>>>>>>" + (endTime - startTime));
			return result;
		} catch (Throwable e) {
			e.printStackTrace();
			return result;
		}
	}
}
